package cn.sofwin.day0130.homework;

import java.util.Stack;

public class MyStack {

    private String[] data;
    private int size;

    public MyStack() {
        this.data = new String[10];
        this.size = 0;
    }

    public void push(String data){
        this.data[size++] = data;
    }

    public String pop(){
        return this.data[size--];
    }

    public int getSize() {
        return size;
    }

    @Override
    public String toString() {
        String value = "[";
        for (int i = 0; i < size; i++) {
            value += this.data[i];
            if (i < (size - 1)){
                value += ", ";
            }
        }
        value += "]";
        return value;
    }
}
